##
# license
snippet //l
	//
	//           ┌┬┐┬ ┬┌─┐┬ ┬┌─┐┌─┐┌┐┌
	//            │ └┬┘├─┘├─┤│ ││ ││││
	//            ┴  ┴ ┴  ┴ ┴└─┘└─┘┘└┘
	//
	// This file is part of the typhoon Project.
	// Copyright (C) 2021 stanley0207@163.com
	//
	// This program is free software: you can redistribute it and/or modify
	// it under the terms of the GNU General Public License as published by
	// the Free Software Foundation, either version 3 of the License, or
	// (at your option) any later version.
	//
	// This program is distributed in the hope that it will be useful,
	// but WITHOUT ANY WARRANTY; without even the implied warranty of
	// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	// GNU General Public License for more details.
	//
	// You should have received a copy of the GNU General Public License
	// along with this program.  If not, see <http://www.gnu.org/licenses/>.
	//
	
	${0}

##
# parameter comment
snippet //p
	///< ${0}

##
# header include guard
snippet guard
	#ifndef ${1:`toupper(utility#FileGuard('$1_H_', 'UNTITLED_H_'))`}
	#define $1

	${0}

	#endif // $1

##
# main
snippet main
	int main(int argc, char *argv[]) {
		${0}
		return 0;
	}

## 
# #include <...>
snippet inc
	#include <${1:stdio}.h>

## 
# #include <...>
snippet Inc
	#include "${1:`utility#Filename("$1.h")`}"

##
# ifndef...define...endif
snippet ndef
	#ifndef $1
	#define ${1:SYMBOL} ${2:value}
	#endif // $1

##
# define
snippet def
	#define

##
# if defined(...)
snippet ifdef
	#if defined(${1:SYMBOL})
		${2}
	#endif

##
# if !defined(...)
snippet ifdefn
	#if !defined(${1:SYMBOL})
		${2}
	#endif

##
# Disable C++ name mangling in C headers
snippet nocxx
	#ifdef __cplusplus
	extern "C" {
	#endif

	${0}

	#ifdef __cplusplus
	} /* extern "C" */
	#endif

##
# if
snippet if
	if (${1:true}) {
		${0:${VISUAL}}
	}

##
# if...else
snippet ife
	if (${1:true}) {
		${2:${VISUAL}}
	} else {
		${0}
	}

##
# else
snippet el
	else {
		${0:${VISUAL}}
	}

##
# else if
snippet elif
	else if (${1:true}) {
		${0:${VISUAL}}
	}

##
# ternary
snippet t
	${1:/* condition */} ? ${2:a} : ${3:b}

##
# switch
snippet switch
	switch (${1:/* variable */}) {
		case ${2:/* variable case */}: {
			${3}
		} ${4:break;}${5}
		default:
			${6}
	}

##
# case
snippet case
	case ${1:/* variable case */}: {
		${2}
	} ${3:break;}

##
# retrun
snippet ret
	return ${0};

##
# for
snippet for
	for (int ${2:i} = 0; $2 < ${1:count}; ${3:++}$2) {
		${4}
	}

##
# for (custom)
snippet forr
	for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
		${5}
	}

##
# while
snippet wh
	while (${1:/* condition */}) {
		${0:${VISUAL}}
	}

##
# do... while
snippet do
	do {
		${0:${VISUAL}}
	} while (${1:0});

##
# enum
snippet enum
	/// ${2:brief}
	enum ${1:name} { 
		k$1None = 0,
		${3},	///< ${4}
	};

##
# printf
snippet pr
	printf("${1:%s}\n"${2});

##
# fprintf
snippet fpr
	fprintf(${1:stderr}, "${2:%s}\n"${3});
